#ifndef _PARSER_H_
#define _PARSER_H_

#include "stdio.h"
#include "string.h"

#include <string>
#include <algorithm>

using namespace std;

class Parser {
public:	
	Parser(char delimiter = ' ');
	
	string getField(string &str,int fieldnum);
	bool addField(string &str, string &sstr, int fieldnum);
	bool deleteField(string &str, int fieldnum);	

	int numField(string &str);

	void setDelemiter(char delimiter);
protected:
	int findnum(string &str, char delimiter, int num);
	
private:
	char delimiter;
	char getDelimiter()const;
	string turnToStr(const char ch);
};

#endif
